#pragma once

#include "KnowledgeBaseMemoryInterface.h"
#include <vector>

class KnowledgeBaseMemory
: public KnowledgeBaseMemoryInterface
{
	friend class Factory < KnowledgeBaseMemoryInterface >;
public:
	static KnowledgeBaseMemoryInterfacePtr Spawn ();
	static void CheckInnocence ();
private:
	KnowledgeBaseMemory ();
	virtual ~KnowledgeBaseMemory ();
	virtual int ElementsCount ();
	virtual KnowledgeBaseElementInterfacePtr Element ( int index );
	virtual void Append ( KnowledgeBaseElementInterfacePtr element );
	virtual void AppendTypeRoot ( KnowledgeBaseElementInterfacePtr element );
	virtual void AppendValueRoot ( KnowledgeBaseElementInterfacePtr element );
	virtual int TypeRootAddress ();
	virtual int ValueRootAddress ();
private:
	std::vector < KnowledgeBaseElementInterfacePtr > elements;
	int typeRootAddress;
	int valueRootAddress;
	static Factory < KnowledgeBaseMemoryInterface > factory;
};
